NetCloak Pro Version 3.0 Pro
User's Guide

Creating Pages: A Tricky Example

Previous | Next
Contents
This example is a feedback system included with your NetCloak Pro disk that allows users to enter comments about the Internet into your server. Other users can then add responses to the original comments. Before you start reading how the tricky example is put together, make sure you have entered a few articles and know how it works. Go to the NetCloak Introduction pages and click on Feedback under the Examples.

The Feedback home page is a standard HTML document with links to the original article entry form and to several separate menu documents. In this example, new articles will be broken down into one of several forums to make it easier for users to find what they want. This particular example uses the forums "General Internet", "This Site", and "Other Sites", but it could be any other logical breakdown of topics. The recipe system, for example, could have had forums for "main courses", "desserts", etc.

Each of the forums has its own menu document. These documents are all exactly the same, except for their titles and minor variations in their text. Most importantly, since each menu document will be updated by NetCloak Pro, each needs to have a single unordered list.

The entry form includes a pop-up list for the topic name instead of a text entry box to avoid user typos. Besides assuring inclusion on the correct list, it is easier for the user. The rest of the form is straightforward.

Now for the interesting part. The "Feedback.FDML" file will generate the original articles. Responses to original articles will be handled by another separate FDML document. The "Feedback.FDML" file is as follows:

     1) <CREATEDOC>     2) "/Feedback/<REPLACE_FN ForumName>Articles/<REPLACE_FN DocTitle>.html"     3) </CREATEDOC>     4) <AUTOLINK>"/AutoLink.doc"</AUTOLINK>     5) <MENUDOC>"/Feedback/<REPLACE_FN ForumName>Menu.html" 
     6) <LI> <A HREF="<HTMLFILENAME>"><REPLACE DocTitle>(<DATE>)</A>     7) </MENUDOC>     8) <RESPONSE>"/Feedback/Response.html"</RESPONSE>     9) <RECENTLIST>    10) <LI> <A HREF="<HTMLFILENAME>"><REPLACE DocTitle></A>    11) </RECENTLIST>    12) <HTML>    13) <HEAD>    14) <TITLE><REPLACE DocTitle></TITLE>    15) </HEAD>    16) <BODY>    17) <H1><REPLACE DocTitle></H1>    18) <ADDRESS>    19) This article submitted by <REPLACE Author> on <DATE>.
    20) </ADDRESS>    21) <BR>    22) <REPLACE ArticleText>    23) <P>    24) <LINKNEXT><BR>    25) <LINKPREVIOUS><BR>    26) <A HREF="<MENUFILENAME>">Return to Topic Menu</A>    27) <HR>    28) <H3>Here is a list of responses that have been posted 
    29) to this article...</H3>    30) <UL>    31) </UL>    32) <HR>    33) <H3>If you would like to post a response to this 
    34) article, fill out this form completely </h3>    35) <FORM METHOD=POST ACTION="/NetCloak.acgi$/Feedback/FeedbackResponse.FDML">    36) Response Title: 
    37) <INPUT TYPE="text" NAME="DocTitle" SIZE="32" MAXLENGTH= "32"> <BR>    38) Author: 
    39) <INPUT TYPE="text" NAME="Author" SIZE="32" MAXLENGTH="32"><P>    40) Response Text:<BR>    41) <TEXTAREA NAME="ArticleText" ROWS=10 COLS=60></TEXTAREA><P>    42) Original Article: 
    43) <INPUT TYPE="text" NAME="OrigArticle" SIZE="20" 
    44) MAXLENGTH="40" VALUE="<REPLACE DocTitle>">(Don't change this field!)
    45) <BR>    46) Forum: 
    47) <INPUT TYPE="text" NAME="OrigForum" SIZE="16" 
    48) MAXLENGTH="16" VALUE="<REPLACE ForumName>">(Don't change this field either!)
    49) <P>    50) <INPUT TYPE="submit" VALUE="Submit Response"> 
    51) <INPUT TYPE="reset"  VALUE="Start Over"><p>    52) </FORM>    53) <HR>    54) Article complete. Click <A HREF="/Feedback/Feedback.html">HERE</A>    55) To return to the Feedback Menu.
    56) </BODY>    57) </HTML>

Lines 1-3 - The CREATEDOC directive places the new document into a sub folder based on the name of the forum using the REPLACE_FN insertion command.

Placing documents into separate forum sub-folders is not necessary, but will help to keep the documents in each folder to a manageable number, in addition to providing a logical breakdown.

Notice the use of REPLACE_FN here where the value will be used as a file or folder name.

Line 4 - The AUTOLINK directive will create automatic links to any key words entered by the user which match entries in the AutoLink.doc file. See the section on the AutoLink directive for an explanation of how this works.

Line 5 - The MENUDOC directive again uses the REPLACE_FN command to update the menu document for the selected forum.

Line 6 - Note the use of the HTMLFILENAME insertion command. This command inserts the path and filename for the html file specified in the CREATEDOC directive. We could have repeated the parameter inside the CREATEDOC directive, but the HTMLFILENAME command is much shorter and makes it easier to understand what is going on.

Here comes the real trick to this example: The HTML documents generated by this FDML will contain not only the content of the original message, but an input form and menu of responses.

Lines 24-25 - The LINKNEXT and LINKPREVIOUS insertion commands here will automatically insert links to the previous article and next article entered. When it creates the HTML document for the current article, NetCloak Pro will put a placeholder in place of the LINKNEXT tag, and replace it with a real link when the next article is entered.

Line 26 - The MENUFILENAME here will automatically insert the complete name and path to the menu file specified in the MENUDOC directive. We could have repeated what was inside the MENUDOC directive, but this is a handy shortcut.

Lines 30-31 - Note the bullet list (<UL></UL>, since it's empty to begin with), which is preceded by a text blurb stating that responses are available. This bullet list will be updated automatically when responses are posted to the original article.

Lines 35-52 - Here is another entry form at the end of the document which the FDML file will create in the new article. The last two fields (lines 43 and 47), when the form is displayed, will default to the correct values and should not be modified by the users. This is where the name of the original article is passed to the FDML which will process the response.

When a user fills in the response entry form, NetCloak Pro will again be invoked, but this time, it will use the "FeedbackResponse.FDML" file:

     1) <CREATEDOC>     2) "/Feedback/<REPLACE_FN OrigForum>Articles/<REPLACE_FN DocTitle>.html"     3) </CREATEDOC>     4) <AUTOLINK>"/AutoLink.doc"</AUTOLINK>     5) <MENUDOC>     6) "/Feedback/<REPLACE_FN OrigForum>Articles/
        <REPLACE_FN OrigArticle>.html"     7) <LI> <A HREF="<HTMLFILENAME>"><REPLACE DocTitle>(<DATE>)</A>     8) </MENUDOC>     9) <RESPONSE>"/Feedback/Response.html"</RESPONSE>    10) <RECENTLIST>    11) <LI> <A HREF="<MENUFILENAME>"><REPLACE OrigArticle></A>    12) </RECENTLIST>    13) <HTML>    14) <HEAD>    15) <TITLE><REPLACE DocTitle></TITLE>    16) </HEAD>    17) <BODY>    18) <H1><REPLACE DocTitle></H1>    19) <ADDRESS>    20) This response submitted by <REPLACE Author> on <DATE>.
    21) </ADDRESS>    22) <BR>    23) <REPLACE ArticleText>    24) <P>    25) <LINKNEXT><BR>    26) <LINKPREVIOUS><BR>    27) <A HREF="<MENUFILENAME>">Return to Main Article</A>    28) <HR>    29) Article complete. Click <A HREF="/Feedback/Feedback.html">HERE</A>    30) To return to the Feedback Menu.
    31) </BODY>    32) </HTML>

The notable thing in FeedbackResponse.FDML is that it uses the original article document as its menu document. By doing this, responses will be added directly in to the bullet list on the original article page.

One additional note about the Tricky Example. Two fields in the "Feedback.FDML" file, "OrigArticle" and "OrigForum", were implemented as standard text fields in order to make what is happening more clear in the example. In a production system, you would most likely want to make these hidden fields so that the user won't ever see them. See an HTML language guide for more details on hidden fields.


Copyright © 1996-1999 Maxum Development Corporation

http://www.maxum.com/
Previous | Next
Contents